package com.zhanghu.single.lazy_single_model;

/**
 * @Author: zhanghu
 * @Description: 懒汉式单例模式，当需要用到的时候才创建对象,而由于懒汉式单例不是线程安全的，故在方法上加上同步锁
 * @Date: Create in 10:00 2020/1/16
 * @modified by:
 */
public class LazySingleModel {
    private static LazySingleModel LAZY_SINGLE_MODEL ;

    private LazySingleModel() {
    }

    public static synchronized LazySingleModel getLazySingleModel() {
        if (LAZY_SINGLE_MODEL==null) {
            LAZY_SINGLE_MODEL = new LazySingleModel();
        }
        return LAZY_SINGLE_MODEL;
    }
}
